package com.android.microweather;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;

public class Utils {
	static Bitmap createBitmap(Context context, ForecastedDay day) throws FileNotFoundException {
		File file = context.getDir(ForecastedDay.DOWNLOAD_DIR, Context.MODE_PRIVATE);
		int pos = day.getImageURL().lastIndexOf('/');
		return BitmapFactory.decodeStream(new FileInputStream(file.getAbsolutePath() +
				   											  day.getImageURL().substring(pos)));
	}
}
